home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* */
- /* ------------ Bit-Bucket Software <no-Inc> */
- /* \ 10001101 / Writers and Distributors of */
- /* \ 011110 / No-Cost<no-tm> Software. */
- /* \ 1011 / */
- /* ------ KopyRong (K) 1987. ALL RIGHTS REVERSED. */
- /* */
- /* */
- /* This module was originally written by Bob Hartman */
- /* */
- /* */
- /* BinkleyTerm FOSSIL version 5 module */
- /* */
- /* */
- /* This software package is being distributed WITH FULL SOURCE CODE */
- /* with the following conditions: 1) If anything awful happens */
- /* because you use it (or don't use it), you accept full */
- /* responsibility; 2) you don't start making tons of voice calls to */
- /* the authors to complain or make suggestions about enhancements, */
- /* useful or otherwise; 3) you do not reuse this code in commercial */
- /* products without specific permission to do so from the authors; */
- /* 4) If you find any problems you send fixes to the authors for */
- /* inclusion in updates; 5) You find some way to express your */
- /* appreciation for this method of distribution, either by writing */
- /* code or application notes, or just sending along a "Thank You" */
- /* message. */
- /* */
- /* There is copyrighted code in this product. We either wrote it */
- /* ourselves or got permission to use it. Please don't force us to */
- /* pay a lawyer -- have some respect for our motives and don't abuse */
- /* this "license". */
- /* */
- /* */
- /*--------------------------------------------------------------------------*/
-
- #include <dos.h>
- #include "opus.h"
- #include "com.h"
-
- static char my_buffer[128];
- static char *my_pointer = my_buffer;
- static char *my_end = my_buffer;
- static int old_fossil = 1;
-
- struct finfo {
- int info_size;
- char curr_fossil;
- char curr_rev;
- char far *id_string;
- int ibufr;
- int ifree;
- int obufr;
- int ofree;
- int swidth;
- int sheight;
- char baud;
- } fossil_info = {
- 0, 0, 0, 0L, 0, 0, 0, 0, 0, 0, 0
- };
-
- fill_buffer ()
- {
- char far *pass;
-
- if (old_fossil)
- {
- ++my_end;
- *my_pointer = Com_(0x02)&0x00ff;
- }
- else
- {
- pass = (char far *) my_pointer;
- my_end += fossil_block (0x1800, pass, 127);
- }
- }
-
- unsigned MODEM_IN ()
- {
- unsigned c;
-
- while (my_pointer == my_end)
- {
- /* Read a buffer full and bump pointer */
- fill_buffer ();
-
- if (my_pointer == my_end)
- time_release();
- }
-
- c = *my_pointer++;
- c &= 0x00ff;
- if (my_pointer == my_end)
- {
- my_pointer = my_buffer;
- my_end = my_buffer;
- }
-
- return (c);
- }
-
- unsigned PEEKBYTE ()
- {
- unsigned c;
-
- if (my_pointer == my_end)
- {
- if (Com_(0x03)&DATA_READY)
- {
- fill_buffer ();
- }
- else
- {
- return (0xFFFF);
- }
- }
-
- c = *my_pointer;
- c &= 0x00ff;
- return (c);
- }
-
- CLEAR_INBOUND ()
- {
- my_pointer = my_buffer;
- my_end = my_buffer;
- Com_(0x0a);
- }
-
- MODEM_STATUS ()
- {
- unsigned int c;
-
- c = Com_(0x03);
- if ((!(c & DATA_READY)) && (my_pointer != my_end))
- c |= DATA_READY;
- return (c);
- }
-
- MDM_ENABLE (b)
- unsigned int b;
- {
- my_pointer = my_end = my_buffer;
- return (Com_(0x00,b|NO_PARITY|STOP_1|BITS_8));
- }
-
- MDM_DISABLE ()
- {
- my_pointer = my_end = my_buffer;
- return (Com_(0x05,BAUD_2400|NO_PARITY|STOP_1|BITS_8));
- }
-
- SENDBYTE (c)
- unsigned char c;
- {
- while (Com_Tx_NW (c) == 0)
- {
- time_release();
- }
- }
-
- SENDCHARS (str, len, car)
- char *str;
- register int len;
- int car;
- {
- register int i;
- char far *p;
-
- if (old_fossil)
- {
- for (; len > 0; --len)
- {
- if (car && !CARRIER)
- return;
- SENDBYTE (*str++);
- }
- }
- else
- {
- i = 0;
- for (; len > 0; len -= i)
- {
- p = (char far *) str;
- i = fossil_block (0x1900, p, len);
- if (i != len)
- {
- str += i;
- time_release();
- }
- else if (car && !CARRIER)
- return;
- }
- }
- }
-
- Cominit (p)
- int p;
- {
- my_pointer = my_end = my_buffer;
- return (ComI(p));
- }
-
- fossil_ver ()
- {
- char far *q;
-
- q = (char far *) &fossil_info;
- fossil_block (0x1b00, q, sizeof (struct finfo));
-
- if (fossil_info.curr_fossil > 0)
- {
- old_fossil = 0;
- cprintf ("FOSSIL: %Fs\033[K\r\n", fossil_info.id_string);
- }
- else
- {
- cprintf ("FOSSIL: Revision Level 3 Assumed\033[K\r\n");
- }
- }
-